using System.Collections;
using System.Collections.Generic;
using System.Dynamic;
using UnityEngine;
using UnityEngine.UI;

public class PartCard : MonoBehaviour
{
    public Builder builder;
    // Start is called before the first frame update
    void Start()
    {
        if  (builder == null)
        {
            builder = GameObject.Find("Builder").GetComponent<Builder>();
        }
        gameObject.GetComponent<Button>().onClick.AddListener(OnClick);
    }

    // Update is called once per frame
    void Update()
    {

    }

    public void OnClick()
    {
        if (!builder.IsBuilded(gameObject.name))
        {
            builder.SelectPart(gameObject.name);
        }
    }
}
